package cn.iocoder.yudao.module.common.dal.mysql.likes;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.common.dal.dataobject.likes.LikesDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.common.controller.admin.likes.vo.*;

/**
 * 点赞 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LikesMapper extends BaseMapperX<LikesDO> {

    default PageResult<LikesDO> selectPage(LikesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LikesDO>()
                .eqIfPresent(LikesDO::getUserId, reqVO.getUserId())
                .eqIfPresent(LikesDO::getTargetId, reqVO.getTargetId())
                .eqIfPresent(LikesDO::getTargetType, reqVO.getTargetType())
                .betweenIfPresent(LikesDO::getLikeTime, reqVO.getLikeTime())
                .likeIfPresent(LikesDO::getCreatorName, reqVO.getCreatorName())
                .betweenIfPresent(LikesDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(LikesDO::getUpdaterName, reqVO.getUpdaterName())
                .eqIfPresent(LikesDO::getVersion, reqVO.getVersion())
                .orderByDesc(LikesDO::getId));
    }

}